#ifndef ZM32_H
#define ZM32_H

/**
 * single light control protocol.
 * */

#ifdef __cplusplus
extern "C" {
#endif

#define BROADCAST_MAC_ALL               (0xFFFFFFFFFFFFFFFFULL)
#define BROADCAST_MAC_NOSLEEP           (0xFFFFFFFFFFFFFFFDULL)
#define BROADCAST_MAC_FFD               (0xFFFFFFFFFFFFFFFCULL)

struct attr {
    unsigned short id;
    unsigned char channel;
    char type[17];
};

struct regs {
    unsigned short start;
    unsigned short num;
};

struct attr_reg_map {
    struct attr attr;
    struct regs regs;
};


void zm32_init(void);
int zm32_read(unsigned long long int mac, unsigned short reg,
              unsigned char num, void *data);
int zm32_write(unsigned long long int mac, unsigned short reg,
               unsigned char num, const void *data);
void zm32_msg_proc(void *msg);
void zm32_finit(void);
int strton(const char *str, const struct attr_reg_map *arm, void *out);
int ntostr(const void *data, const struct attr_reg_map *arm, char *str);

#ifdef __cplusplus
}
#endif


#endif